<script>
// 	var roomId = ${(roomItem.id)!};
	function selectRoomType(value) {
		printLog(value);
		$('#editRoomLayout').layout('panel','center').panel('refresh', "deviceLink.do?chooseDeviceLink&flag=fromRoomConfig&param="+value.name);  
		setTimeout("showRoomConfigInfo()",500); 
	}
	
	//保存信息
	function saveRoomInfo() {
		var rows = $('#roomConfigSelectDeviceLinkList').datagrid('getRows');
		var roomInfo = [{
			id:$('#roomId').val(),
			serviceArea:$('#roomServiceArea').combobox('getValue'),
			type:$('#roomType').combobox('getText'),
			roomNo:$('#roomNo').val(),
			status:$('#roomStatus').combobox('getValue'),
			name:$('#roomName').val(),
			floor:$('#roomFloor').combobox('getValue'),
			deviceId:$('#roomDeviceName').combobox('getValue'),
			deviceName:$('#roomDeviceName').combobox('getText'),
			scene:$('#roomScene').combobox('getValue'),
			configInfo:$('#configInfo').val(),
			deviceLinks:rows
		}];
		printLog(roomInfo);
		$.post("room.do?saveRoomInfos", {data:JSON.stringify(roomInfo)}, function(result) {
			showMsg(result.msg);
		  	if(result.success){
	       	  	reloadRoom();
          	}
	  	}, "JSON");
	}
</script>
<div class="easyui-layout" data-options="fit:true" id="editRoomLayout">
    <div data-options="region: 'north', border:false" style="height:200px" >
		<table cellpadding="5">
			<input id="roomId" name="id" type="hidden" value="${(roomItem.id)!}" />
			<tr>
				<td>所属区域:</td>
				<td>
					<@eu.comboBox id="roomServiceArea" url="common.do?loadComboBox&key=SERVICE_AREA&value=${(roomItem.serviceArea)!}" name="serviceArea" required="true"/>
				</td>
				<td>楼层:</td>
				<td>
					<@eu.comboBox id="roomFloor" url="common.do?loadComboBox&key=ROOM_FLOOR&value=${(roomItem.floor)!}" name="roomFloor"/>
				</td>
				<td>
					配置信息：
				</td>
			</tr>
			<tr>
				<td>房间类型:</td>
				<td>
					<@eu.comboBox id="roomType" url="common.do?loadComboBox&key=ROOM_TYPE&text=${(roomItem.type)!}" name="type" required="true" onSelect="selectRoomType(value)"/>
				</td>
				<td>房间号:</td>
				<td>
					<input id="roomNo" name="roomNo"  class="easyui-validatebox" data-options="required: true" value="${(roomItem.roomNo)!}" validType="remote['room.do?checkRoomNoIsExit&id=${(roomItem.id)!}','roomNo']" invalidMessage="房间号已存在"/>
				</td>
				
				<td rowspan="3">
					<textarea id="configInfo" style="height: 90px;" rows="6"  name="configInfo" class="easyui-validatebox" data-options="required: true"  readonly="readonly" missingMessage="请在下面选择房间配置的元件信息" >${(roomItem.configInfo)!}</textarea>
				</td>
			</tr>
			<tr>
				<td>房间名称:</td>
				<td>
					<input id="roomName" name="name"  class="easyui-validatebox" data-options="required: true" value="${(roomItem.name)!}"/>
				</td>
				<td>房间状态:</td>
				<td>			
					<@eu.comboBox id="roomStatus" url="common.do?loadComboBox&key=ROOM_STATUS&value=${(roomItem.status)!}" name="status" required="true"/>
				</td>
			</tr>
			<tr>
				<td>设置RCU设备:</td>
				<td>
					<@eu.comboBox id="roomDeviceName" url="device.do?loadDevices&text=${(roomItem.deviceName)!}" name="deviceName" required="true" validType="remote['room.do?checkRcuIsExit&id=${(roomItem.id)!}','roomDeviceName']" invalidMessage="设备已绑定其它客房"/>
				</td>
			</tr>
			<tr>
				<td>场景设置:</td>
				<td>
					<@eu.comboBox id="roomScene" url="common.do?loadComboBox&key=ROOM_SCENE&value=${(roomItem.scene)!}" name="scene" required="true"/>
				</td>
			</tr>
		</table>
	</div>
	<div data-options="region:'center',border:false,fit:true,title:'配置房间设备',href:'deviceLink.do?chooseDeviceLink&flag=fromRoom&param=${(roomItem.id)!}'">
		
	</div>	
</div>
